import org.rsbot.script.methods.Walking;
import org.rsbot.script.wrappers.RSArea;
import org.rsbot.script.wrappers.RSPath;
import org.rsbot.script.wrappers.RSTile;
import org.rsbot.script.wrappers.RSTilePath;

public abstract class AionAirCrafter$WalkToArea extends AionAirCrafter.Action
{
  private RSPath path;

  public AionAirCrafter$WalkToArea(AionAirCrafter paramAionAirCrafter, RSPath paramRSPath)
  {
    this.path = paramRSPath;
  }
  protected abstract boolean canRest();

  protected abstract boolean isTargetValid();

  public boolean isValid() { return isTargetValid(); }

  public void process()
  {
    if (AionAirCrafter.access$2300(this.this$0).getEnergy() < 20) {
      if ((canRest()) && (AionAirCrafter.access$2400(this.this$0))) {
        RSTilePath localRSTilePath = AionAirCrafter.access$2500(this.this$0).newTilePath(AionAirCrafter.Constants.AREA_MUSICIAN.getTileArray());
        if (!localRSTilePath.traverse()) {
          AionAirCrafter.access$2600(this.this$0).newTilePath(new RSTile[] { AionAirCrafter.Constants.AREA_MUSICIAN.getCentralTile() }).traverse();
        }
        AionAirCrafter.access$1400(this.this$0, this.this$0.random(600, 900));
        AionAirCrafter.access$2700(this.this$0).rest(100);
      }
    } else if (!AionAirCrafter.access$2800(this.this$0).isRunEnabled()) {
      AionAirCrafter.access$2900(this.this$0).setRun(true);
    }
    this.path.traverse();
  }
}